

import get from '@dfeidao/atom-web/local/get';
import remove from '@dfeidao/atom-web/local/remove';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';
import hide_loading from '../../atom/hide-loading';
import show_loading from '../../atom/show-loading';

interface Aa {
	_id: string;
}
export default async function a012(fd: IFeidaoAiBrowserComponent) {

	const productid = get(fd, 'productid');
	//  删除
	const shezhi = get(fd, 'shezhi') as Aa;
	const role_allot_id = get(fd, 'role_allot_id');
	if (!shezhi) {
		error('请选择要删除的数据');

		return;
	}
	if (!role_allot_id) {
		error('请选择权限组');

		return;
	}
	show_loading();
	const res = await nodejs('roler/zj-000004/s013', { _id: shezhi._id, productid });
	hide_loading();
	if (res === 'success') {
		fire('zj-000004', 'ec-005', shezhi, 3);
		success('删除成功');
	} else {
		error('删除失败');
	}
	remove(fd, 'shezhi');
}
